﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAO
{
    public class DAO_NHANVIEN
    {
        static QLTTTHDataContext QLTTTH = new QLTTTHDataContext();
        int DemNV()
        {
            var Dem = (from nv in QLTTTH.NHANVIENs
                       where nv.TRANGTHAI == true
                       select nv.MANV).Count();
            return Dem;
        }
        public static string TaoMaNV()
        {
            int iDem = new DAO_NHANVIEN().DemNV();
            string sMaNV="NV";
            if (iDem < 10)
                sMaNV = sMaNV + "0" + "0" + iDem.ToString();
            if (iDem < 100)
                sMaNV = sMaNV + "0" + iDem.ToString();
            return sMaNV;
        }
    }
}
